package com.ciei.dpagm.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.Date;

/**
 * @author pp
 * @date 2023/03/10
 */
@TableName(value = "common_condition")
public class Condition {

    @TableId(type = IdType.AUTO)
    private Integer conditionId;
    private Integer ruleId;
    private Integer ruleSetId;
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String description;
    private String factMode;
    private Integer comparator;
    private String standardSpecification;
    private Integer orderId;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;
    private Integer creatorId;
    private Integer updateUserId;
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer isDelete;

    public Condition() {
    }

    public Condition(Integer conditionId, Integer ruleId, Integer ruleSetId, String description, String factMode, Integer comparator, String standardSpecification, Integer orderId, Date createTime, Date updateTime, Integer creatorId, Integer updateUserId, Integer isDelete) {
        this.conditionId = conditionId;
        this.ruleId = ruleId;
        this.ruleSetId = ruleSetId;
        this.description = description;
        this.factMode = factMode;
        this.comparator = comparator;
        this.standardSpecification = standardSpecification;
        this.orderId = orderId;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.creatorId = creatorId;
        this.updateUserId = updateUserId;
        this.isDelete = isDelete;
    }

    public Integer getConditionId() {
        return conditionId;
    }

    public void setConditionId(Integer conditionId) {
        this.conditionId = conditionId;
    }

    public Integer getRuleId() {
        return ruleId;
    }

    public void setRuleId(Integer ruleId) {
        this.ruleId = ruleId;
    }

    public Integer getRuleSetId() {
        return ruleSetId;
    }

    public void setRuleSetId(Integer ruleSetId) {
        this.ruleSetId = ruleSetId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getFactMode() {
        return factMode;
    }

    public void setFactMode(String factMode) {
        this.factMode = factMode;
    }

    public Integer getComparator() {
        return comparator;
    }

    public void setComparator(Integer comparator) {
        this.comparator = comparator;
    }

    public String getStandardSpecification() {
        return standardSpecification;
    }

    public void setStandardSpecification(String standardSpecification) {
        this.standardSpecification = standardSpecification;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Integer creatorId) {
        this.creatorId = creatorId;
    }

    public Integer getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Integer updateUserId) {
        this.updateUserId = updateUserId;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    /**
     * 深拷贝
     * @return
     * @throws JsonProcessingException
     */
    public Condition deepCopy() throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        return objectMapper.readValue(objectMapper.writeValueAsString(this), Condition.class);
    }
}
